package com.wmlive.hhvideo.heihei.personal.adapter;

import android.view.View;
import android.view.ViewGroup;

import com.dyuiapi.api.model.ShortVideoInfo;
import cn.wmlive.hhvideo.R;
import com.wmlive.hhvideo.heihei.beans.main.ShortVideoItem;
import com.wmlive.hhvideo.utils.imageloader.GlideLoader;
import com.wmlive.hhvideo.widget.refreshrecycler.RefreshAdapter;
import com.wmlive.hhvideo.widget.refreshrecycler.RefreshRecyclerView;

import java.util.List;

/**
 * Created by XueFei on 2017/5/27.
 */

public class DraftBoxAdapter extends RefreshAdapter<DraftBoxHolder, ShortVideoInfo> {

    public DraftBoxAdapter(List<ShortVideoInfo> list, RefreshRecyclerView refreshView) {
        super(list, refreshView);
    }

    @Override
    public DraftBoxHolder onCreateHolder(ViewGroup parent, int viewType) {
        return new DraftBoxHolder(parent, R.layout.activity_draftbox_item);
    }

    @Override
    public void onBindHolder(DraftBoxHolder holder, final int position, ShortVideoInfo data) {
        GlideLoader.loadImage(data.getFirstVideoClip(), holder.ivBg, R.drawable.bg_video_default_16_9);

        holder.ivDelete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (null != mOnClickFansCustom) {
                    mOnClickFansCustom.onClick(v, position);
                }
            }
        });
    }

    private OnClickFansCustom mOnClickFansCustom;

    public interface OnClickFansCustom {
        void onClick(View view, int position);
    }

    public void setOnClickCustom(OnClickFansCustom onClickFansCustom) {
        mOnClickFansCustom = onClickFansCustom;
    }
}
